import './assets/main.css'
// @ts-ignore
import components from '@/components/index.js'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import DkUI from '@vipl520/dk-ui'
// import Vue3DraggableResizable from 'vue3-draggable-resizable'
import Vant from 'vant'
// 2. 引入组件样式
import 'vant/lib/index.css'
import 'animate.css/animate.min.css'
// 样式
import 'virtual:uno.css'
import 'element-plus/dist/index.css'
import '@/assets/style.scss'
import 'element-plus/theme-chalk/display.css'
import '@vipl520/dk-ui/lib/index.scss'

import JsonViewer from 'vue3-json-viewer'
// if you used v1.0.5 or latster ,you should add import "vue3-json-viewer/dist/index.css"
import 'vue3-json-viewer/dist/vue3-json-viewer.css'
import { InstallCodeMirror } from 'codemirror-editor-vue3'
import 'codemirror/theme/monokai.css'
import 'codemirror/mode/javascript/javascript.js'
import 'codemirror/mode/php/php.js'
import 'codemirror/mode/vue/vue.js'
import 'codemirror/mode/sql/sql.js'
// import { setupStore } from '@/stores'
import { getToken, updateGlobalConfig } from '@/utils/auth'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
// @ts-ignore
import FcDesigner from '@/components/FcDesigner/index.js'
import formCreate from '@form-create/element-ui'

import App from './App.vue'
import router from './router'
updateGlobalConfig()

const app = createApp(App)
app.use(ElementPlus, { locale: zhCn })
app.use(formCreate)
app.use(FcDesigner)
app.use(Vant)
app.use(components)
app.use(JsonViewer)
app.use(InstallCodeMirror)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(DkUI, {
  AccessToken: getToken(),
  ApiUrl: import.meta.env.VITE_BASE_URL, // 默认的 API 地址
  AddonName: 'gs_developer',
  ProjectType: 'addon'
})
app.use(createPinia())
app.use(router)

app.mount('#app')
